home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / ace_gpl_release / src / lib / asm / scroll.s < prev    next >
Encoding:
Text File  |  1998-10-04  |  2.5 KB  |  116 lines

  1. ;
  2. ; scroll.s -- an ACE linked library module: scroll bits in a rastport.
  3. ; Copyright (C) 1998 David Benn
  4. ; This program is free software; you can redistribute it and/or
  5. ; modify it under the terms of the GNU General Public License
  6. ; as published by the Free Software Foundation; either version 2
  7. ; of the License, or (at your option) any later version.
  8. ;
  9. ; This program is distributed in the hope that it will be useful,
  10. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ; GNU General Public License for more details.
  13. ;
  14. ; You should have received a copy of the GNU General Public License
  15. ; along with this program; if not, write to the Free Software
  16. ; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  17. ;
  18. ; Author: David J Benn
  19. ;   Date: 19th March 1994
  20. ;
  21. ; registers d0-d6 and a0-a3 are modified by some of the following. BEWARE!
  22. ;
  23. ; a4,a5 are used by link/unlk.
  24. ; a6 is library base holder.
  25. ; a7 is stack pointer. 
  26. ; d7 is used for array index calculations.
  27. ;
  28.  
  29. ; * CONSTANTS *
  30. Width        equ 8
  31. Height        equ 10
  32. Font        equ 52
  33. tf_YSize    equ 20
  34.  
  35.     xdef    _scroll_screen
  36.  
  37.        ; external references
  38.     xref    _pos    
  39.     xref    _csrlin    
  40.     xref    _locate
  41.     xref    _windowfunc
  42.     xref    _font_height
  43.     xref    _max_line
  44.     xref    _wdth
  45.     xref    _hgt
  46.     xref    _Wdw
  47.     xref    _RPort
  48.     xref    _GfxBase
  49.     xref    _LVOScrollRaster
  50.  
  51.     SECTION scroll_code,CODE
  52.  
  53. ;
  54. ; Scroll up one text line? Font and window height are taken into account.
  55. ;
  56. _scroll_screen:
  57.     move.l    a6,-(sp)    ; store a6 (this routine called from C)
  58.  
  59.     ; get Wdw height & max. lines
  60.     move.w    #3,d0
  61.     jsr    _windowfunc    ; d0 = window height
  62.  
  63.     ; find font height
  64.     movea.l    _RPort,a0
  65.     movea.l    Font(a0),a0
  66.     move.w    tf_YSize(a0),d1
  67.     move.w    d1,_font_height
  68.  
  69.     ; determine maximum line
  70.     divu    d1,d0
  71.     subi.w    #2,d0
  72.     move.w    d0,_max_line
  73.  
  74. _get_curr_line:
  75.     ; get current line
  76.     jsr    _csrlin        ; d0=current LINE 
  77.     
  78.     ; current line > max-line?
  79.     move.w    _max_line,d1    ; d1=max-line
  80.     cmp.w    d1,d0
  81.     bgt.s    _do_scroll    ; YES
  82.  
  83.     move.l    (sp)+,a6
  84.  
  85.     rts            ; NO
  86.  
  87. _do_scroll:
  88.     move.w    _font_height,-(sp)
  89.     movea.l    _Wdw,a0
  90.     move.w    Width(a0),_wdth
  91.     move.w    Height(a0),_hgt
  92.     
  93.     ; scroll screen up one character
  94.     movea.l    _GfxBase,a6
  95.     movea.l    _RPort,a1
  96.     moveq    #0,d0        ; delta_x = 0
  97.     move.w    (sp)+,d1    ; delta_y = font height
  98.     moveq    #0,d2
  99.     moveq    #0,d3        ; 0,0 = xmin,ymin
  100.     move.w    _wdth,d4    
  101.     move.w    _hgt,d5        ; xmax,ymax
  102.     jsr    _LVOScrollRaster(a6)
  103.                 
  104.     ; move print position to bottom line.
  105.     jsr    _pos
  106.     move.w    d0,d1        ; d1=COLUMN
  107.     move.w    _max_line,d0    ; d0=LINE
  108.     jsr    _locate
  109.  
  110.     move.l    (sp)+,a6
  111.         
  112.     rts
  113.  
  114.     END
  115.